#ifndef AACTOPCM_H
#define AACTOPCM_H

#include <queue>
#include <string>
#include "neaacdec.h"

class AacToPcm {

public:
    explicit AacToPcm(uint64_t maxParseSize);
    ~AacToPcm();

    int inputAacData(uint8_t *data, uint32_t len);
    std::string outputPcmData();
    int init();

protected:
    int splitAacData();
    std::string aacToPcm(const std::string &aacData);

private:
    uint64_t _maxParseSize;
    std::vector<std::string> _aacSplitData;
    std::queue<std::string> _pcmQueue;
    int _lastAacPos;
    std::string _aacData;
    bool _aac2pcmInitFlag;
    NeAACDecHandle _hDecoder;

};

#endif

